@isTest 
public class HF_ClientWSImport_Test{

   static testmethod void Testmethod1() {
   WebServiceFinal4.BasicEndpoint pims=new WebServiceFinal4.BasicEndpoint();
   HF_ClientWSImport Hssimp = new HF_ClientWSImport();   
   WebServiceFinal2.GetContactWrapper rsw = new WebServiceFinal2.GetContactWrapper();
  
   Id recId = [Select Id from Recordtype where Developername =: 'AffiliateRecord'].Id;
     
   PIMS_Reserved_Id__c p1 = new PIMS_Reserved_Id__c(PIMS_Id__c='7771-7805',Used__c = false);
   Insert P1;
   
   PIMS_Reserved_Id__c p2 = new PIMS_Reserved_Id__c(PIMS_Id__c='7771-7804',Used__c = false);
   Insert P2;
     
   Account Acc = new Account(Name = 'TestAccount', Type = 'U.S.Affiliate',Partner_ID__c = '1111-2222', RecordtypeId = RecId);
   Insert Acc;
   
   Contact conts = new Contact(FirstName = 'TestFirst', LastName = 'TestLast', AccountId = Acc.Id,Email='test@test.com'); 
   Insert conts;
   
   State__c s = new State__c(Name='S',Value_in_PIMS__c ='MNN',Value_in_SFDC__c = 'Colima (COL)', Country_code__c = 'US');
   Insert s;
   
   RelationshipType__c rs = new RelationshipType__c(Value_in_SFDC__c ='Test',Value_in_PIMS__c='T',Name='DS');
   Insert rs;
   
   AddressType__c at = new AddressType__c(Value_in_SFDC__c ='Sample',Value_in_PIMS__c='S',Name='DS');
   Insert at;
    
   PhoneType__c pt = new PhoneType__c(Value_in_SFDC__c ='Sample',Value_in_PIMS__c='S',Name='DS');
   Insert pt;
    
   EmailType__c et = new EmailType__c(Value_in_SFDC__c ='Sample',Value_in_PIMS__c='S',Name='DS');
   Insert et;
   
   Gender__c gen = new Gender__c(Name='S',Value_in_PIMS__c ='M',Value_in_SFDC__c = 'Male');
   Insert gen;
     
   Status__c sts = new Status__c(Name='S',Value_in_PIMS__c ='A',Value_in_SFDC__c = 'Active');
   Insert sts;
   
   
   //rsw=pims.GetContactDetails('6767-8989',1);
   
   Hssimp.getStateName('MNN','US');
   Hssimp.getRelationshipType('T');
   Hssimp.getEmailType('S');
   Hssimp.getphoneType('S');
   Hssimp.getaddrType('S');
   
   WebServiceFinal2.AddressWrapper aw = new WebServiceFinal2.AddressWrapper();
         aw.AddressLine1 = 'TestAddress1';
         aw.AddressLine2 = 'TestAddress2';
         aw.AddressType = 'TestAddType';
         aw.City ='TestCity';
         aw.Comments = 'Test';
         aw.Country = 'Angolia (AO)';
         aw.County = 'Test';
         aw.DataOn = System.datetime.now();
         aw.LoginID = 'Null';
         aw.NameID = 1;
         aw.PartnerContactID = '7789-8976';
         aw.PreferredAddress = 'test Address';
         aw.SfdcAddressID = 'TestID';
         aw.State = 'TestState';
         aw.Status = 'Active';
         aw.StreetAddress = 'testStreet';
         aw.ZipCode = '98789';
         aw.ZipCodeExtension = '989';
   
   List<WebServiceFinal2.RelationshipWrapper> relwr = new List<WebServiceFinal2.RelationshipWrapper>();      
   WebServiceFinal2.RelationshipWrapper rw = new WebServiceFinal2.RelationshipWrapper();
         rw.Comments = 'Test';
         rw.DataOn = System.datetime.now();
         rw.EndDate = Null;
         rw.LoginID = 'Test';
         rw.PartnerContactID='1111-2222';
         rw.RelatedNameID = 1;
         rw.RelatedPartnerID='7898-3434';
         rw.RelationshipType='Test';
         rw.SfdcRelationshipID='Test';
         rw.StartDate = System.datetime.now();
         rw.Status='A';
     relwr.add(rw);       
  
   WebServiceFinal2.ArrayOfRelationshipWrapper arr = new WebServiceFinal2.ArrayOfRelationshipWrapper();   
   arr.RelationshipWrapper = relwr;
   rsw.RelationshipInfo = arr; 
   
   WebServiceFinal2.ContactWrapper cw = new WebServiceFinal2.ContactWrapper();
   cw.DataOn = System.datetime.now();
   cw.FirstName = 'First';
   cw.Gender = 'M';
   cw.LastName = 'Lastname';
   cw.LoginID = 'Test';
   cw.MiddleName = 'MidName';
   cw.NameID = 1;
   cw.PartnerContactID = '7890-2345';
   cw.PreferredName = 'Y';
   cw.SfdcContactID = conts.id;
   cw.Status='A';
   
   List<WebServiceFinal2.PhoneWrapper> pwwrr = new List<WebServiceFinal2.PhoneWrapper>();
   WebServiceFinal2.PhoneWrapper pw = new WebServiceFinal2.PhoneWrapper();
     pw.Comments = 'Comm';
     pw.Country = 'Angolia (AO)';
     pw.DataOn = system.datetime.now();
     pw.Extn = '2345';
     pw.LoginID = 'Test';
     pw.NameID = 1;
     pw.PartnerContactID ='7789-8976';
     pw.Phone = '3445555676';
     pw.PhoneType = 'Test';
     pw.PreferredPhone = 'Y';
     pw.SfdcPhoneID = conts.id;
     pw.Status = 'A';
     pwwrr.add(pw);
     
     WebServiceFinal2.ArrayOfPhoneWrapper arrph = new WebServiceFinal2.ArrayOfPhoneWrapper();
     arrph.PhoneWrapper = pwwrr;
     rsw.PhoneInfo = arrph;
     
     WebServiceFinal2.EmailWrapper ew = new WebServiceFinal2.EmailWrapper();
     ew.Comments = 'comm';
     ew.DataOn = system.datetime.now();
     ew.Email = 'test@test.com';
     ew.EmailType = 'Test';
     ew.LoginID = 'test';
     ew.NameID = 1;
     ew.PartnerContactID = '7890-2345';
     ew.PreferredEmail = 'N';
     ew.SfdcEmailID = conts.id;
      
   rsw.ContactInfo = cw; 
   rsw.AddressInfo = aw;
   rsw.EmailInfo = ew;
  // rsw.PhoneInfo = pw;
   //rsw.RelationshipInfo = arr ;
    
   ApexPages.StandardController sc=new ApexPages.StandardController(conts);
   HF_SearchController searchcontroller=new HF_SearchController(sc);
   
   PageReference pageRef = ApexPages.currentPage();
   pageRef = new ApexPages.StandardController(conts).view();
   
   Hssimp.InsertWrapperRecords(rsw);
             
               
   pageRef =searchcontroller.importContact();
   
   
   }   
}